package com.eedi.framework.job.dal.mapper;


import com.eedi.framework.common.pojo.PageResult;
import com.eedi.framework.job.controller.org.vo.job.OrgJobPageReq;
import com.eedi.framework.job.dal.dataobject.OrgJobDO;
import com.eedi.framework.mybatis.core.mapper.BaseMapperX;
import com.eedi.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 定时任务 Mapper
 *
 * @author liuyf
 */
@Mapper
public interface OrgJobMapper extends BaseMapperX<OrgJobDO> {

    default OrgJobDO selectByHandlerName(String handlerName) {
        return selectOne(OrgJobDO::getHandlerName, handlerName);
    }

    default PageResult<OrgJobDO> selectPage(OrgJobPageReq reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrgJobDO>()
                .likeIfPresent(OrgJobDO::getName, reqVO.getName())
                .eqIfPresent(OrgJobDO::getStatus, reqVO.getStatus())
                .likeIfPresent(OrgJobDO::getHandlerName, reqVO.getHandlerName())
        );
    }

}
